/**  
* @Title: PermissionDaoImpl.java  
* @Package com.clps.dev.sms.dao.sm.impl  
* @Description:  PermissionDaoImpl.java  
* @author RuiShan.Yang  
* @date 2018-11-27 15:47:15 
* @version V1.0  
*/

package com.clps.dev.sms.dao.sm.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.clps.dev.sms.common.dao.impl.BaseDaoImpl;
import com.clps.dev.sms.dao.sm.PermissionDao;
import com.clps.dev.sms.entity.sm.Permission;

/**  
* @ClassName: PermissionDaoImpl  
* @Description: PermissionDaoImpl  实现类
* @since JDK 1.8 
* @author RuiShan.Yang  
* @date 2018-11-27 15:47:15  
* 
*/
@Repository
public class PermissionDaoImpl extends BaseDaoImpl<Permission> implements PermissionDao {
	private static final String HQL_QUERY_BY_PERMISSION_NAME = "FROM Permission WHERE permissionName LIKE '%'||?||'%'";
	List<Permission> permissionlist = null;
	/**  
	* 创建一个新的实例 PermissionDaoImpl.  
	*/
	public PermissionDaoImpl() {
		super(Permission.class);
	}

	/**
	* <p>Title: queryBySql</p>  
	* <p>Description: </p> 
	* @see com.clps.dev.sms.dao.sm.PermissionDao#queryPermissionBySql(java.lang.String)  
	*/
	@SuppressWarnings("unchecked")
	@Override
	public List<Permission> queryPermissionBySql(String sql) {
		 permissionlist = getSession().createSQLQuery(sql).list();
		return permissionlist;
	}

	/**
	* <p>Title: queryByPermissionName</p>  
	* <p>Description: </p> 
	* @see com.clps.dev.sms.dao.sm.PermissionDao#queryPermissionByPermissionLikeName(java.lang.String)  
	*/
	@SuppressWarnings("unchecked")
	@Override
	public List<Permission> queryPermissionByPermissionLikeName(String permissionName) {
		permissionlist  = (List<Permission>) this.getHibernateTemplate().find(HQL_QUERY_BY_PERMISSION_NAME, permissionName);
		return permissionlist;
	}
}
